/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.db.generator.field.models;

/**
 *
 * @author abosancic
 */
public class DataBaseColumnType {

    protected String name;
    protected String type;
    protected Integer lenght;

    public DataBaseColumnType() {
    }

    public DataBaseColumnType(String name, String type, Integer lenght) {
        this.name = name;
        this.type = type;
        this.lenght = lenght;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getLenght() {
        return lenght;
    }

    public void setLenght(Integer lenght) {
        this.lenght = lenght;
    }

    @Override
    public String toString() {
        return name + "," + type + "," + lenght;
    }

    public static synchronized DataBaseColumnType toModel(String value) {
        String tmp[] = value.split(",");
        DataBaseColumnType model = new DataBaseColumnType(tmp[0], tmp[1], new Integer(tmp[2]));
        return model;
    }
    
}